<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>


// 测试 JSON 对象
const jsonObject = {
  "basic": ["contact", "calllog", "sms", "note"],
  "app": {
    "com.android.providers.contacts": {
      "name": "通讯录",
      "package": "com.android.providers.contacts",
      "exported": false
    },
    "com.android.providers.telephony": {
      "name": "短信息",
      "package": "com.android.providers.telephony",
      "exported": false
    },
    "com.tencent.mm": {
      "name": "微信",
      "package": "com.tencent.mm",
      "exported": false
    },
    "com.tencent.mobileqq": {
      "name": "QQ",
      "package": "com.tencent.mobileqq",
      "exported": false
    },
    "com.eg.android.AlipayGphone": {
      "name": "支付宝",
      "package": "com.eg.android.AlipayGphone",
      "exported": false
    },
    "com.miui.notes": {
      "name": "小米便签",
      "package": "com.miui.notes",
      "exported": false
    },
    "cn.cj.pe": {
      "name": "139邮箱",
      "package": "cn.cj.pe",
      "exported": false
    },
    "com.corp21cn.mail189": {
      "name": "189邮箱",
      "package": "com.corp21cn.mail189",
      "exported": false
    },
    "com.tencent.androidqqmail": {
      "name": "QQ邮箱",
      "package": "com.tencent.androidqqmail",
      "exported": false
    },
    "com.netease.mobimail": {
      "name": "网易邮箱",
      "package": "com.netease.mobimail",
      "exported": false
    },
    "com.netease.mail": {
      "name": "网易邮箱大师",
      "package": "com.netease.mail",
      "exported": false
    },
    "com.asiainfo.android": {
      "name": "沃邮箱",
      "package": "com.asiainfo.android",
      "exported": false
    },
    "cn.mailchat": {
      "name": "邮洽邮箱",
      "package": "cn.mailchat",
      "exported": false
    },
    "com.hpbr.bosszhipin": {
      "name": "BOSS直聘",
      "package": "com.hpbr.bosszhipin",
      "exported": false
    },
    "club.sugar5.app": {
      "name": "SUGAR苏格",
      "package": "club.sugar5.app",
      "exported": false
    },
    "cn.neoclub.uki": {
      "name": "Uki",
      "package": "cn.neoclub.uki",
      "exported": false
    },
    "com.iksocial.queen": {
      "name": "不就",
      "package": "com.iksocial.queen",
      "exported": false
    },
    "com.immomo.vchat": {
      "name": "赫兹",
      "package": "com.immomo.vchat",
      "exported": false
    },
    "com.huayin.hualian": {
      "name": "花吱",
      "package": "com.huayin.hualian",
      "exported": false
    },
    "com.jsd.yemao": {
      "name": "夜猫",
      "package": "com.jsd.yemao",
      "exported": false
    },
    "com.kuaishou.nebula": {
      "name": "快手极速版",
      "package": "com.kuaishou.nebula",
      "exported": false
    },
    "com.driftbottle.app": {
      "name": "恋爱漂流瓶",
      "package": "com.driftbottle.app",
      "exported": false
    },
    "com.autonavi.minimap": {
      "name": "高德地图",
      "package": "com.autonavi.minimap",
      "exported": false
    },
    "com.baidu.BaiduMap": {
      "name": "百度地图",
      "package": "com.baidu.BaiduMap",
      "exported": false
    },
    "com.woyue.batchat": {
      "name": "蝙蝠",
      "package": "com.woyue.batchat",
      "exported": false
    },
    "com.immomo.momo": {
      "name": "陌陌",
      "package": "com.immomo.momo",
      "exported": false
    },
    "com.ifreetalk.ftalk": {
      "name": "派派",
      "package": "com.ifreetalk.ftalk",
      "exported": false
    },
    "com.duowan.xunhuan": {
      "name": "轻语",
      "package": "com.duowan.xunhuan",
      "exported": false
    },
    "cn.tantady.tt": {
      "name": "声吧交友",
      "package": "cn.tantady.tt",
      "exported": false
    },
    "club.jijigugu.yiguan": {
      "name": "一罐",
      "package": "club.jijigugu.yiguan",
      "exported": false
    },
    "com.im.xhj.android": {
      "name": "陪你约玩",
      "package": "com.im.xhj.android",
      "exported": false
    },
    "com.cijianlink.cjlk": {
      "name": "幸识",
      "package": "com.cijianlink.cjlk",
      "exported": false
    },
    "com.leeboo.fjyue": {
      "name": "附近约会",
      "package": "com.leeboo.fjyue",
      "exported": false
    },
    "com.bingo.yeliao": {
      "name": "十点聊天",
      "package": "com.bingo.yeliao",
      "exported": false
    },
    "com.huohua.android": {
      "name": "火花",
      "package": "com.huohua.android",
      "exported": false
    },
    "com.jiaren.banlv": {
      "name": "密聊交友",
      "package": "com.jiaren.banlv",
      "exported": false
    },
    "com.chuye.xiaoqingshu": {
      "name": "小情书婚恋交友",
      "package": "com.chuye.xiaoqingshu",
      "exported": false
    },
    "com.cherry.chat": {
      "name": "樱桃聊天交友",
      "package": "com.cherry.chat",
      "exported": false
    },
    "cn.dylovemm.csyh": {
      "name": "虚拟恋人",
      "package": "cn.dylovemm.csyh",
      "exported": false
    },
    "com.qihoo.browser": {
      "name": "360浏览器",
      "package": "com.qihoo.browser",
      "exported": false
    },
    "com.android.chrome": {
      "name": "Chrome",
      "package": "com.android.chrome",
      "exported": false
    },
    "com.tencent.mtt": {
      "name": "QQ浏览器",
      "package": "com.tencent.mtt",
      "exported": false
    },
    "com.UCMobile": {
      "name": "UC浏览器",
      "package": "com.UCMobile",
      "exported": false
    },
    "com.baidu.browser.apps": {
      "name": "百度浏览器",
      "package": "com.baidu.browser.apps",
      "exported": false
    },
    "com.baidu.searchbox": {
      "name": "百度",
      "package": "com.baidu.searchbox",
      "exported": false
    },
    "com.baidu.searchbox.lite": {
      "name": "百度极速版",
      "package": "com.baidu.searchbox.lite",
      "exported": false
    },
    "com.quark.browser": {
      "name": "夸克浏览器",
      "package": "com.quark.browser",
      "exported": false
    },
    "org.mozilla.firefox": {
      "name": "Firefox",
      "package": "org.mozilla.firefox",
      "exported": false
    },
    "com.duowan.mobile": {
      "name": "YY",
      "package": "com.duowan.mobile",
      "exported": false
    },
    "dji.go.v5": {
      "name": "大疆",
      "package": "dji.go.v5",
      "exported": false
    },
    "com.yy.ourtimes": {
      "name": "ME",
      "package": "com.yy.ourtimes",
      "exported": false
    },
    "com.lizhi.pplive": {
      "name": "PP约玩",
      "package": "com.lizhi.pplive",
      "exported": false
    },
    "com.vliao.vchat": {
      "name": "V聊",
      "package": "com.vliao.vchat",
      "exported": false
    },
    "com.ss.android.ugc.aweme": {
      "name": "抖音",
      "package": "com.ss.android.ugc.aweme",
      "exported": false
    },
    "com.mi.xiong": {
      "name": "蜜熊",
      "package": "com.mi.xiong",
      "exported": false
    },
    "com.ourydc.yuebaobao": {
      "name": "哩咔",
      "package": "com.ourydc.yuebaobao",
      "exported": false
    },
    "com.zenmen.palmchat": {
      "name": "连信",
      "package": "com.zenmen.palmchat",
      "exported": false
    },
    "com.meiliao.mlfsb": {
      "name": "美聊",
      "package": "com.meiliao.mlfsb",
      "exported": false
    },
    "com.xiaomi.channel": {
      "name": "米聊",
      "package": "com.xiaomi.channel",
      "exported": false
    },
    "aihuishou.aihuishouapp": {
      "name": "爱回收",
      "package": "aihuishou.aihuishouapp",
      "exported": false
    },
    "com.eastmoney.android.berlin": {
      "name": "东方财富股票",
      "package": "com.eastmoney.android.berlin",
      "exported": false
    },
    "com.lingxi.cupid": {
      "name": "对缘",
      "package": "com.lingxi.cupid",
      "exported": false
    },
    "com.baidao.silver": {
      "name": "会选股",
      "package": "com.baidao.silver",
      "exported": false
    },
    "com.mm.jiaoliao": {
      "name": "娇聊",
      "package": "com.mm.jiaoliao",
      "exported": false
    },
    "com.julun.jiuliao": {
      "name": "就聊",
      "package": "com.julun.jiuliao",
      "exported": false
    },
    "com.moyou": {
      "name": "开聊",
      "package": "com.moyou",
      "exported": false
    },
    "com.ailiao.yuehui": {
      "name": "秀色爱聊视频交友",
      "package": "com.ailiao.yuehui",
      "exported": false
    },
    "com.milian.jiaoyouba": {
      "name": "秘恋",
      "package": "com.milian.jiaoyouba",
      "exported": false
    },
    "com.tongchengsupei.mtyh": {
      "name": "陌聊同城速配交友",
      "package": "com.tongchengsupei.mtyh",
      "exported": false
    },
    "com.midao.lbvideochat": {
      "name": "蜜岛",
      "package": "com.midao.lbvideochat",
      "exported": false
    },
    "com.skype.rover": {
      "name": "Skype",
      "package": "com.skype.rover",
      "exported": false
    },
    "com.sina.weibo": {
      "name": "新浪微博",
      "package": "com.sina.weibo",
      "exported": false
    },
    "com.baidu.netdisk": {
      "name": "百度网盘",
      "package": "com.baidu.netdisk",
      "exported": false
    },
    "com.ss.android.ugc.aweme.lite": {
      "name": "抖音极速版",
      "package": "com.ss.android.ugc.aweme.lite",
      "exported": false
    },
    "com.p1.mobile.light": {
      "name": "探探极速版",
      "package": "com.p1.mobile.light",
      "exported": false
    },
    "com.mszmapp.detective": {
      "name": "百变大侦探",
      "package": "com.mszmapp.detective",
      "exported": false
    },
    "com.yunfeng.re": {
      "name": "右耳",
      "package": "com.yunfeng.re",
      "exported": false
    },
    "com.youyuan.yhb": {
      "name": "约会吧",
      "package": "com.youyuan.yhb",
      "exported": false
    },
    "com.VideoCall.GuangShu": {
      "name": "颜聊",
      "package": "com.VideoCall.GuangShu",
      "exported": false
    },
    "com.youyue.hx": {
      "name": "红线相亲",
      "package": "com.youyue.hx",
      "exported": false
    },
    "com.xingjiabi.shengsheng": {
      "name": "他趣",
      "package": "com.xingjiabi.shengsheng",
      "exported": false
    },
    "com.p1.mobile.putong": {
      "name": "探探",
      "package": "com.p1.mobile.putong",
      "exported": false
    },
    "me.yidui": {
      "name": "伊对",
      "package": "me.yidui",
      "exported": false
    },
    "com.jiayuan": {
      "name": "世纪佳缘",
      "package": "com.jiayuan",
      "exported": false
    },
    "com.quyue.android": {
      "name": "趣约会",
      "package": "com.quyue.android",
      "exported": false
    },
    "com.mm.tutu": {
      "name": "同城爱会",
      "package": "com.mm.tutu",
      "exported": false
    },
    "com.tencent.tim": {
      "name": "TIM",
      "package": "com.tencent.tim",
      "exported": false
    },
    "com.tencent.qqlite": {
      "name": "QQ极速版",
      "package": "com.tencent.qqlite",
      "exported": false
    },
    "com.tencent.minihd.qq": {
      "name": "QQHD版",
      "package": "com.tencent.minihd.qq",
      "exported": false
    },
    "com.smile.gifmaker": {
      "name": "快手",
      "package": "com.smile.gifmaker",
      "exported": false
    },
    "com.ss.iphone.article.News": {
      "name": "今日头条",
      "package": "com.ss.iphone.article.News",
      "exported": false
    },
    "com.ss.iphone.article.lite": {
      "name": "今日头条极速版",
      "package": "com.ss.iphone.article.lite",
      "exported": false
    },
    "com.taou.NeiTui": {
      "name": "脉脉",
      "package": "com.taou.NeiTui",
      "exported": false
    },
    "com.microsoft.emmx": {
      "name": "Edge",
      "package": "com.microsoft.emmx",
      "exported": false
    },
    "com.microsoft.bing": {
      "name": "bing",
      "package": "com.microsoft.bing",
      "exported": false
    },
    "com.mmbox.xbrowser": {
      "name": "X浏览器",
      "package": "com.mmbox.xbrowser",
      "exported": false
    },
    "com.mmbox.xbrowser.pro": {
      "name": "X浏览器pro",
      "package": "com.mmbox.xbrowser.pro",
      "exported": false
    },
    "com.jx.privatebrowser": {
      "name": "私密浏览器",
      "package": "com.jx.privatebrowser",
      "exported": false
    },
    "mark.via": {
      "name": "via",
      "package": "mark.via",
      "exported": false
    },
    "jp.naver.line.android": {
      "name": "LINE",
      "package": "jp.naver.line.android",
      "exported": false
    },
    "com.whatsapp": {
      "name": "Whatspp",
      "package": "com.whatsapp",
      "exported": false
    },
    "com.onelab.securecomm": {
      "name": "Letstalk",
      "package": "com.onelab.securecomm",
      "exported": false
    },
    "com.skype.raider": {
      "name": "Skype",
      "package": "com.skype.raider",
      "exported": false
    },
    "com.kakao.talk": {
      "name": "KakaoTalk",
      "package": "com.kakao.talk",
      "exported": false
    },
    "org.thoughtcrime.securesms": {
      "name": "Signal",
      "package": "org.thoughtcrime.securesms",
      "exported": false
    },
    "com.zing.zalo": {
      "name": "Zalo",
      "package": "com.zing.zalo",
      "exported": false
    },
    "org.telegram.messenger.web": {
      "name": "Telegram_web",
      "package": "org.telegram.messenger.web",
      "exported": false
    },
    "org.telegram.plus": {
      "name": "Plus",
      "package": "org.telegram.plus",
      "exported": false
    },
    "org.telegram.messenger": {
      "name": "Telegram",
      "package": "org.telegram.messenger",
      "exported": false
    },
    "com.appspartner.iflirts": {
      "name": "iFlirts",
      "package": "com.appspartner.iflirts",
      "exported": false
    },
    "com.google.android.apps.dynamite": {
      "name": "Chat",
      "package": "com.google.android.apps.dynamite",
      "exported": false
    },
    "fun.kitsunebi.kitsunebi4android": {
      "name": "Kitsunebi",
      "package": "fun.kitsunebi.kitsunebi4android",
      "exported": false
    },
    "com.v2ray.ang": {
      "name": "v2rayNG",
      "package": "com.v2ray.ang",
      "exported": false
    },
    "com.github.kr328.clash.foss": {
      "name": "Clash",
      "package": "com.github.kr328.clash.foss",
      "exported": false
    },
    "com.getsurfboard": {
      "name": "Surfboard",
      "package": "com.getsurfboard",
      "exported": false
    },
    "com.baidu.input": {
      "name": "百度输入法",
      "package": "com.baidu.input",
      "exported": false
    },
    "com.tencent.wetype": {
      "name": "微信输入法",
      "package": "com.tencent.wetype",
      "exported": false
    },
    "com.tencent.qqpinyin": {
      "name": "QQ输入法",
      "package": "com.tencent.qqpinyin",
      "exported": false
    },
    "com.sohu.inputmethod.sogou": {
      "name": "搜狗输入法",
      "package": "com.sohu.inputmethod.sogou",
      "exported": false
    },
    "com.alibaba.android.rimet": {
      "name": "钉钉",
      "package": "com.alibaba.android.rimet",
      "exported": false
    },
    "com.tencent.wework": {
      "name": "企业微信",
      "package": "com.tencent.wework",
      "exported": false
    },
    "com.facebook.fsbk": {
      "name": "FaceBook",
      "package": "com.facebook.fsbk",
      "exported": false
    },
    "com.gna.weif": {
      "name": "微信分身",
      "package": "com.gna.weif",
      "exported": false
    },
    "com.qiyi.video": {
      "name": "爱奇艺",
      "package": "com.qiyi.video",
      "exported": false
    },
    "com.tencent.qqpim": {
      "name": "QQ同步助手",
      "package": "com.tencent.qqpim",
      "exported": false
    },
    "com.mas.itodo": {
      "name": "iTodo",
      "package": "com.mas.itodo",
      "exported": false
    },
    "tv.danmaku.bili": {
      "name": "哔哩哔哩",
      "package": "tv.danmaku.bili",
      "exported": false
    },
    "com.jingdong.app.mall": {
      "name": "京东",
      "package": "com.jingdong.app.mall",
      "exported": false
    },
    "com.gotokeep.keep": {
      "name": "Keep",
      "package": "com.gotokeep.keep",
      "exported": false
    },
    "tv.pps.mobile": {
      "name": "爱奇艺随刻",
      "package": "tv.pps.mobile",
      "exported": false
    },
    "com.ssports.mobile.video": {
      "name": "爱奇艺体育",
      "package": "com.ssports.mobile.video",
      "exported": false
    },
    "com.lianjia.beike": {
      "name": "贝壳找房",
      "package": "com.lianjia.beike",
      "exported": false
    },
    "com.ss.android.ugc.live": {
      "name": "抖音火山版",
      "package": "com.ss.android.ugc.live",
      "exported": false
    },
    "com.sohu.sohuhy": {
      "name": "狐友",
      "package": "com.sohu.sohuhy",
      "exported": false
    },
    "com.todoplan.qingdan": {
      "name": "番茄todo",
      "package": "com.todoplan.qingdan",
      "exported": false
    },
    "com.iqiyi.ivrcinema.cb": {
      "name": "爱奇艺VR",
      "package": "com.iqiyi.ivrcinema.cb",
      "exported": false
    },
    "com.xunmeng.pinduoduo": {
      "name": "拼多多",
      "package": "com.xunmeng.pinduoduo",
      "exported": false
    }
  }
};
function formatJsonToStringWithPlus(jsonObject) {
  // 处理 "basic" 数组
  const basicArray = jsonObject.basic.map(item => `    \"${item}\"`).join(",\n");

  // 处理 "app" 对象
  const appObject = Object.entries(jsonObject.app).map(([key, value]) => {
    return `    \"${key}\":{`
      + `\n        \"name\": \"${value.name}\",`
      + `\n        \"package\": \"${value.package}\",`
      + `\n        \"exported\": ${value.exported}`
      + `\n    }`;
  }).join(",\n");

  // 拼接最终的字符串，并使用 + 拼接
  return "{\n"
    + "\"basic\":[\n"
    + basicArray + "\n"
    + "],\n"
    + "\"app\":{\n"
    + appObject + "\n"
    + "}\n"
    + "}";
}



const formattedString = formatJsonToStringWithPlus(jsonObject);

// 将生成的字符串格式化为带 "+" 符号的字符串
const formattedWithPlus = formattedString
  .replace(/\n/g, '\n+ "')
  .replace(/^/, '"+ "');

// 输出最终格式化后的字符串
console.log(formattedWithPlus);

    </script>
</body>
</html>